package com.example.job.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.job.domain.message.MessageText;
import com.example.job.mapper.message.MessageTextMapper;
import com.example.job.service.IMessageTextService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

@Slf4j
@Service
public class MessageTextServiceImpl extends ServiceImpl<MessageTextMapper, MessageText> implements IMessageTextService {

    @Override
    public boolean batchInsert(List<MessageText> messageTextList) {
        try {
            boolean result = saveBatch(messageTextList);
            if (result) {
                log.info("批量插入 MessageText 成功，插入数量：{}", messageTextList.size());
            } else {
                log.warn("批量插入 MessageText 失败，插入数量：{}", messageTextList.size());
            }
            return result;
        } catch (Exception e) {
            log.error("批量插入 MessageText 时发生异常", e);
            return false;
        }
    }
}
